package cn.nexttec.noteplayer.ui.activities

import android.net.Uri
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.activity.result.contract.ActivityResultContracts
import cn.nexttec.noteplayer.databinding.ActivityRichEditorBinding

class RichEditorActivity : AppCompatActivity() {
    private lateinit var _binding:ActivityRichEditorBinding
    private val binding get() = _binding



    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        _binding = ActivityRichEditorBinding.inflate(layoutInflater)
        setContentView(binding.root)

        val pickImageLauncher = registerForActivityResult(
            ActivityResultContracts.GetContent()
        ) { uri: Uri? ->
            uri?.let { binding.editor.insertImage(it) }
        }
        binding.editor.setImagePickerLauncher(pickImageLauncher)
    }

}